package com.auz.datagenerator.heuristics.value;

import javax.swing.JPanel;

import com.auz.datagenerator.heuristics.value.gui.ValueHeuristicComponent;

/**
 * Value heuristic generating values according to the strength setting adjusted on
 * the associated GUI component.
 * 
 * @author Aurelien Bonnel
 */
public class StrengthValueHeuristic extends AbstractValueHeuristic<Double> {

	/**
	 * The default strength
	 */
	public final double DEFAULT_STRENGTH = 1;
	private double strength;
	
	/**
	 * Constructor
	 * @param _base - the base value
	 */
	public StrengthValueHeuristic(double _base) {
		super(_base);
		strength = DEFAULT_STRENGTH;
	}

	/**
	 * Returns the value associated with this heuristic
	 * @return the value
	 */
	public Double getValue() {
		return strength;
	}

	/**
	 * Returns the GUI component associated with this heuristic
	 * @return the GUI component associated with this heuristic
	 */
	public JPanel fetchGUIComponent() {
		component = new ValueHeuristicComponent(this, "Strength (arb)");
		component.configureSlider(1, 10, 1, 1, 1);
		component.pack();
		return component;
	}

	/**
	 * Sets the parameter value to the specified value
	 * @param _param - the new parameter value
	 */
	public void changeParameter(int _param) {
		strength = _param;
	}

	/**
	 * Returns the value associated with the representational function associated to this heuristic
	 * @return the value associated with the representational function associated to this heuristic
	 */
	public Double getRepresentationalValue(double _x) {
		// TODO Auto-generated method stub
		return 0.0;
	}
}
